package com.shop.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.pojo.sms.Sms_Home_Adv;
import com.shop.service.Sms_Home_Adv_Service;
import com.shop.utils.LayuiUtils;
import com.shop.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *轮播图--后台
 */
@RestController
@RequestMapping("/home_adv")
public class Sms_Home_Adv_Controller {

    @Autowired
    private Sms_Home_Adv_Service sms_home_adv_service;

    /**
     * 显示所有轮播图
     * @param page
     * @param limit
     * @param sha
     * @return
     */
    @GetMapping("/find_admin_home_adv_All")
    public LayuiUtils<Sms_Home_Adv>  find_admin_home_adv_All(Integer page, Integer limit, Sms_Home_Adv sha)
    {
        Page<Sms_Home_Adv> Pages = new Page<>(page,limit);

        return sms_home_adv_service.find_admin_home_adv_All(Pages,sha);
    }

    /**
     * 新增轮播图
     * @param sha
     * @return
     */
    @PostMapping("/insert_admin_home_adv_All")
    public R insert_admin_home_adv_All(Sms_Home_Adv sha){
        System.out.println(sha);
        return sms_home_adv_service.insert_admin_home_adv_All(sha);
    }

    /**
     * 删除轮播图
     * @param id
     * @return
     */
    @DeleteMapping("/del_admin_home_adv_All")
    public R del_admin_home_adv_All(@RequestParam List<Long> id){
        return sms_home_adv_service.del_admin_home_adv_All(id);
    }

    /**
     * 修改轮播图
     * @param sha
     * @return
     */
    @PutMapping("/up_admin_home_adv_All")
    public R up_admin_home_adv_All(Sms_Home_Adv sha){

        return sms_home_adv_service.up_admin_home_adv_All(sha);
    }

}
